package com.goddess.yeecolor.view;

import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import com.goddess.yeecolor.R;

/**
 * 设置标题
 */
public class Titles {

    public static TextView initTitle(View view, String title){
        TextView textTitle=(TextView)view.findViewById(R.id.title_content);
        textTitle.setVisibility(View.VISIBLE);
        textTitle.setText(title);
        return textTitle;
    }
    public static ImageView initBack(View view, int id, View.OnClickListener listener){
        ImageButton ibTitleLeftBtn=(ImageButton)view.findViewById(R.id.title_back);
        ibTitleLeftBtn.setVisibility(View.VISIBLE);
        ibTitleLeftBtn.setImageResource(id);
        ibTitleLeftBtn.setOnClickListener(listener);
        return ibTitleLeftBtn;
    }
    public static ImageView initRight(View view, int id, View.OnClickListener listener){
        ImageButton ibTitleLeftBtn=(ImageButton)view.findViewById(R.id.title_right);
        ibTitleLeftBtn.setVisibility(View.VISIBLE);
        ibTitleLeftBtn.setImageResource(id);
        ibTitleLeftBtn.setOnClickListener(listener);
        return ibTitleLeftBtn;
    }

    public static TextView initTitleLeft(View view, String title, View.OnClickListener onClickListener){
        TextView textTitle=(TextView)view.findViewById(R.id.title_left);
        textTitle.setVisibility(View.VISIBLE);
        textTitle.setText(title);
        textTitle.setOnClickListener(onClickListener);
        return textTitle;
    }
    public static TextView initTitleRight(View view, String title, View.OnClickListener onClickListener){
        TextView textTitle=(TextView)view.findViewById(R.id.title_righttext);
        textTitle.setVisibility(View.VISIBLE);
        textTitle.setText(title);
        textTitle.setOnClickListener(onClickListener);
        return textTitle;
    }
    public static TextView initTitleRight2(View view, String title, View.OnClickListener onClickListener){
        TextView textTitle=(TextView)view.findViewById(R.id.title_righttext2);
        textTitle.setVisibility(View.VISIBLE);
        textTitle.setText(title);
        textTitle.setOnClickListener(onClickListener);
        return textTitle;
    }
}

